package com.zlzlib.log.bean.vo;

import com.zlzlib.log.bean.po.LogPo;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @DateTime: 2023/3/9 17:34
 * @Author zlz
 * @Version 1.0
 */
@Data
public class LogListVo {

    private long totals;

    private List<LogVo> data;

    @Data
    public static class LogVo {
        /**
         * 客户端ip
         */
        private String ip;

        private String logType;
        /**
         * 线程
         */
        private String thread;
        /**
         * 耗时
         */
        private String time;
        /**
         * 类名
         */
        private String className;
        /**
         * 方法
         */
        private String method;
        /**
         * 参数
         */
        private String param;
        /**
         * 请求头
         */
        private String header;
        /**
         * 结果
         */
        private String result;
        /**
         * 记录时间
         */
        private Date createTime;

        public static LogVo poToVo(LogPo po) {
            LogVo logVo = new LogVo();
            logVo.setLogType(po.getLogType());
            logVo.setThread(po.getThread());
            logVo.setCreateTime(po.getCreateTime());
            logVo.setMethod(po.getMethod());
            logVo.setTime(po.getTime());
            logVo.setParam(po.getParam());
            logVo.setResult(po.getResult());
            logVo.setHeader(po.getHeader());
            logVo.setIp(po.getIp());
            logVo.setClassName(po.getClassName());
            return logVo;
        }
    }
}

